<style type="text/css">
	.tableinput{border:1px #666 solid !important;width: 40%;height: 38px;padding-left: 5px;}
</style>
{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
	<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd><input type="text" class="input" id="search" placeholder="请输入您需要搜索的会员名字！" name="search"><input type="submit" value="搜索" class="button" /></dd>
				<!-- <dd><a href="wood_help.html"><i class="iconfont">&#xe649;</i>帮助文档</a></dd> -->
			</dl>
		</div>
		<div class="content">
			<div class="release">
				<form>
					<dl>	
						<dt>
							<p>查看某时间段内消费额，选择开始时间与结束时间，点击查询</p>
							<input type="text" name="stime" placeholder="请选择开始时间" class="tableinput" readonly="" value="{{.stime}}">
							<input type="text" name="etime" placeholder="请选择结束时间" class="tableinput" readonly="" value="{{.etime}}">
						</dt>
						<input type="hidden" name="id" value="{{.business.id}}">
						<input type="hidden" name="page" value="{{.page}}">
						<dd><input type="submit" value="查询" class="button"></dd>
					</dl>
				</form>
			</div>
			<!-- 会员列表 -->
			<table class="table">
				<thead><th width="15%">头像</th><th width="15%">会员信息</th><th width="15%">账户信息</th><th width="15%">当前消费情况</th><th width="15%">状态</th><th width="10%">操作</th></thead>
				{{range $i,$v := .info}}
				{{if $v}}
				<tr id="{{.id}}">
					<td class="center"><a href="/admin/member/content?id={{.id}}"><img src="{{.pathname}}" class="img-1" onerror="javascript:this.src='/static/img/admin/avatar.jpg'"></a></td>
					<td>
						<a href="/admin/member/content?id={{.id}}">{{.monicker}}</a> （ ID：{{.id}} ）<br>
						手机：{{.mobile}}<br>
						地址：{{.country}} {{.province}} {{.city}} {{.address}}
					</td>
					<td>
						余额：&yen; {{.money}} <a href="/admin/member/money?id={{.id}}&t=3" class="tz">明细</a><br>
						积分： {{.integral}} <a href="/admin/member/integral?id={{.id}}" class="tz">明细</a><br>
						等级：{{if .vipName}}<mark>{{.vipName}}</mark>{{else}}普通会员{{end}} 
					</td>
					<td>
						<span style="color: red;">消费额：{{.moneys}}</span> <br>
						<span style="color: black;">退款额：{{.remoneys}}</span> <br>
						<!-- <span style="color: black;">待付款：{{.willmoneys}}</span> -->
					</td>
					<td>
						登入次数：{{.loginnumber}} 次<br>
						最近登入：{{.logintime}}<br>
						登入 I P ：{{.loginip}}
					</td>
					<td class="operation">
						<a href="/admin/member/edit?id={{.id}}">个人编辑</a><br>
						<a href="/admin/member/content?id={{.id}}">个人详情</a><br>
						<a href="/admin/member/order?id={{.id}}">订单统计</a><br>
						<a class="del" data-uid="{{.id}}" data-id="{{$.business.id}}">删除</a>
					</td>
				</tr>
				{{end}}
				{{end}}
				{{if .paginator}}
				{{if ne .paginator.totalpages 1}}
					<tr>
						<td  colspan="5">
							<div class="paging">
								{{if ne .paginator.currpage 1}}
								<a href="{{$.url}}page={{.paginator.firstpage}}">首页</a>
								<a href="{{$.url}}page={{.paginator.prevpage}}">&lt;&lt;</a>
								{{else}}
								<a class="disable">首页</a>
								<a class="disable">&lt;&lt;</a>
								{{end}}
								{{range $index,$page := .paginator.pages}}
								{{if eq $.paginator.currpage $page}} 
								<a class="no">{{$page}}</a>
								{{else}}
								<a href="{{$.url}}page={{$page}}">{{$page}}</a>
								{{end}}
								{{end}}
								{{if eq .paginator.currpage .paginator.totalpages}}
								<a class="disable">&gt;&gt;</a>
								<a class="disable">尾页</a>
								{{else}}
								<a href="{{$.url}}page={{.paginator.nextpage}}">&gt;&gt;</a>
								<a href="{{$.url}}page={{.paginator.totalpages}}">尾页</a>
								{{end}}
							</div>
						</td>
					</tr>
				{{end}}
				{{end}}
			</table>
		</div>
	</article>
</section>

<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
<script>
	$("input[name=stime]").jeDate({
	    isinitVal:false,
	    festival: false,
	    isToday:true, 
	    format: 'YYYY-MM-DD'
	});
	$("input[name=etime]").jeDate({
	    isinitVal:false,
	    festival: false,
	    isToday:true, 
	    format: 'YYYY-MM-DD'
	});
	$('.del').click(function(){
		var id=$(this).attr('data-id');
		var uid = $(this).attr('data-uid')
		var that = $(this)
		wxc.xcConfirm("您是否取消跟踪此客户?","confirm",{onOk:function(){
			$.ajax({
				url:'/admin/member/business_del_customer',
				data:{id: id, uid: uid},
				type:'get',
				success:function(res) {
					if (res.status === 1) {
						that.parent().parent().remove()
						showMessage('操作成功~')
					} else {
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})	
		}});
	})
	
	$('#changeProhibit').click(function () {
		var id=$(this).attr('data-id');
		var status=$(this).attr('data-status');
		var that=$(this)
		$.ajax({
			url:'/admin/change',
			data:{table:'mt_member',id:id,status:status},
			type:'get',
			success:function(res) {
				if(res.status==1){
					that.html(res.info)
					showMessage('操作成功~')
				}else{
					wxc.xcConfirm("操作失败,请重试","error");
				}
			}
		})	
	})
	$('#search').keydown(function (e) {
		if (e.keyCode != 13) return
		search($(this).val().trim())
	})
	$('[type=submit]').click(function (){
		search($('#search').val().trim())
	})
	function search(val) {
		var id = {{.id}}
		var search = val
		location.search = '?id=' + id + '&search=' + search
	}
</script>
</body>
</html>
